from django.conf import settings
from django.urls import path
from django.views.static import serve

from .views import *

app_name = 'main'

urlpatterns = [
    path('media/<path:path>', serve, {'document_root': settings.MEDIA_ROOT}),
    path('home_create/', CreateProjectView.as_view(), name='home_create'),

    path('home_update/<int:pk>', HomeUpdateView.as_view(), name='home_update'),
    path('home/', HomeListView.as_view(), name='home'),
    path('category/', CategoryListView.as_view(), name='category'),
    path('category/create/', CategoryCreateView.as_view(), name='category_create'),
    path('category/delete/<int:pk>/', CategoryDeleteView.as_view(), name='category_delete'),
    path('category/<int:pk>/', CategoryDetailView.as_view(), name='category_detail'),
    path('home_delete/<int:pk>/', HomeDeleteView.as_view(), name='home_delete'),
    path('product_images/', ProductImageListView.as_view(), name='product_images'),
    path('product/<int:pk>/', ProductDetailView.as_view(), name='product_detail'),
    path('product/<int:pk>/images/', ProductImageCarouselView.as_view(), name='product_image_carousel'),
    
    # 订单管理
    path('orders/', OrderListView.as_view(), name='order_list'),
    path('order/<int:pk>/', OrderDetailView.as_view(), name='order_detail'),
    path('order/<int:pk>/update/', OrderUpdateView.as_view(), name='order_update'),
    
    # 用户管理
    path('users/', UserListView.as_view(), name='user_list'),
    path('user/<int:pk>/', UserDetailView.as_view(), name='user_detail'),
    
    # 地址管理
    path('addresses/', AddressListView.as_view(), name='address_list'),
    path('address/create/', AddressCreateView.as_view(), name='address_create'),
    path('address/<int:pk>/update/', AddressUpdateView.as_view(), name='address_update'),
    path('address/<int:pk>/delete/', AddressDeleteView.as_view(), name='address_delete'),
    
    # 用户增删改
    path('user/create/', UserCreateView.as_view(), name='user_create'),
    path('user/<int:pk>/update/', UserUpdateView.as_view(), name='user_update'),
    path('user/<int:pk>/delete/', UserDeleteView.as_view(), name='user_delete'),
    
    # 商品图片增删改
    path('product_image/create/', ProductImageCreateView.as_view(), name='product_image_create'),
    path('product_image/<int:pk>/update/', ProductImageUpdateView.as_view(), name='product_image_update'),
    path('product_image/<int:pk>/delete/', ProductImageDeleteView.as_view(), name='product_image_delete'),
    
    # 订单增删改
    path('order/create/', OrderCreateView.as_view(), name='order_create'),
    path('order/<int:pk>/delete/', OrderDeleteView.as_view(), name='order_delete'),
    
    # 统计仪表板
    path('dashboard/', DashboardView.as_view(), name='dashboard'),

]
